package bkhech.generator.mp.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * GenConfigExtra
 *
 * @author guowm
 * @date 2024/7/26
 */
@SuppressWarnings("all")
@Component
@ConfigurationProperties(prefix = "gen.extra")
@PropertySource(value = {"${config.generator}"}, encoding = "UTF-8")
public class GenConfigExtra {
    /**
     * 模块名，默认 报名最后一层级目录
     */
    public static String moduleName;

    /**
     * 自定义生成 domain 路径, 默认 domain 目录下
     */
    public static String genPathOfDomain;

    /**
     * mapper包名称, 默认值：{@link bkhech.generator.mp.constant.GenConstants.MAPPER_PACKAGE_NAME}
     */
    public static String mapperPackageName;

    /**
     * mapper xml 空间名称, 默认值：{@link bkhech.generator.mp.constant.GenConstants.MAPPER_XML_NAMESPACE}
     */
    public static String mapperXmlNamespace;

    /**
     * 基类对象字段, 默认值：{@link bkhech.generator.mp.constant.GenConstants.BASE_ENTITY}
     */
    public static List<String> baseEntityFields;

    /**
     * BO对象 不需要查询的字段, 默认值：{@link bkhech.generator.mp.constant.GenConstants.COLUMNNAME_NOT_QUERY}
     */
    public static List<String> columnNameNotQuery;

    /**
     * VO对象 不需要返回的字段, 默认值：{@link bkhech.generator.mp.constant.GenConstants.COLUMNNAME_NOT_LIST}
     */
    public static List<String> columnNameNotList;

    @Value("${moduleName:}")
    public void setModuleName(String moduleName) {
        GenConfigExtra.moduleName = moduleName;
    }

    @Value("${genPathOfDomain:}")
    public void setGenPathOfDomain(String genPathOfDomain) {
        GenConfigExtra.genPathOfDomain = genPathOfDomain;
    }

    @Value("${mapperPackageName:}")
    public void setMapperPackageName(String mapperPackageName) {
        GenConfigExtra.mapperPackageName = mapperPackageName;
    }

    @Value("${mapperXmlNamespace:}")
    public void setMapperXmlNamespace(String mapperXmlNamespace) {
        GenConfigExtra.mapperXmlNamespace = mapperXmlNamespace;
    }

    @Value("${baseEntityFields:}")
    public void setBaseEntityFields(List<String> baseEntityFields) {
        GenConfigExtra.baseEntityFields = baseEntityFields;
    }

    @Value("${columnNameNotQuery:}")
    public void setColumnNameNotQuery(List<String> columnNameNotQuery) {
        GenConfigExtra.columnNameNotQuery = columnNameNotQuery;
    }

    @Value("${columnNameNotList:}")
    public void setColumnNameNotList(List<String> columnNameNotList) {
        GenConfigExtra.columnNameNotList = columnNameNotList;
    }
}